package com.springcloud.configclient.alibaba.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {
    @Value("${service-url.nacos-user-service}")
    private  String uri;//http://nacos-payment-provider
    @Autowired
    private RestTemplate restTemplate;
    @GetMapping(value = "/consumer/payment/nacos/{id}")
    public String getPayment(@PathVariable("id") Integer id) {
        System.out.println("---------nacos  consumer --------------");
        System.out.println(uri);
       return restTemplate.getForObject(uri+"/payment/nacos/"+id,String.class);
    }
}
